<?php
/** Define ABSPATH as this files directory */
define('ABSPATH', dirname(__FILE__) . '/' );
define('BASE_PATH', $_SERVER['DOCUMENT_ROOT'].'/');
define('BASE_URL', 'http://local.ecommerce/');
// Configuration
if (file_exists('config.php')) {
	require_once('config.php');
} 
error_reporting(E_ALL);
ini_set('display_errors', '1');

require_once ABSPATH.'classes/DB.class.php';
require_once ABSPATH.'classes/User.class.php';
require_once ABSPATH.'classes/UserTools.class.php';

//connect to the database
$GLOBALS['FE_DB'] = new DB();
$GLOBALS['FE_DB']->connect();

//initialize UserTools object
$GLOBALS['FE_USER_TOOL'] = new UserTools();

//start the session
session_start();

//refresh session variables if logged in
if(isset($_SESSION['logged_in'])) {
	$user = unserialize($_SESSION['user']);
	$_SESSION['user'] = serialize($GLOBALS['FE_USER_TOOL']->findUserByUid($user->id));
}
?>